import requestMeeting, { request } from '@/plugins/axios'
import { FetchMeetingFile, meetingDetailEntity } from './interface'

export const FetchMeetingFiles = async (moid: string) =>
	request<{ meeting_files: Array<FetchMeetingFile> }>({
		url: `/meeting_files/${moid}`,
		method: 'get',
		params: {},
	})
		.then((res) => (res.success ? res.meeting_files : []))
		.catch((res) => [])

export const FetchMeetingDetail = async (moid: string) =>
	requestMeeting<meetingDetailEntity>({
		url: `/meetings/${moid}/all`,
		method: 'get',
		params: {},
	})
		.then((res) => res)
		.catch((res) => res)

export const FetchRegularDetail = async (regularMeetingMoid: string) =>
	requestMeeting<meetingDetailEntity>({
		url: `/regular_meeting/${regularMeetingMoid}`,
		method: 'get',
		params: {},
	})
		.then((res) => res)
		.catch((res) => res)
